﻿using Digitalmes.Model;
using Digitalmes.Model.PackageManagement;
using Digitalmes.Model.PlanningManagement;
using Digitalmes.Model.ProductManagement;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
using WalkingTec.Mvvm.Core;

namespace Digitalmes.Model.PackageManagement
{
    /// <summary>
    /// 装箱记录
    /// </summary>
	[Table("PackageRecord")]

    [Display(Name = "_Model.PackageRecord")]
    public class PackageRecord : TopBasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._PackageRecord._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._PackageRecord._WoId")]
        [Comment("工单")]
        public long? WoId { get; set; }

        public ProductionOrder Wo { get; set; }

        [Display(Name = "_Model._PackageRecord._WoCode")]
        [Comment("工单编码")]
        public string WoCode { get; set; }
        [Display(Name = "_Model._PackageRecord._ProductId")]
        [Comment("装箱产品")]
        public long? ProductId { get; set; }


        public Product Product { get; set; }

        [Display(Name = "_Model._PackageRecord._ProductName")]
        [Comment("产品名称")]
        public string ProductName { get; set; }
        [Display(Name = "_Model._PackageRecord._Sn")]
        [Comment("装箱条码")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string Sn { get; set; }
        [Display(Name = "_Model._PackageRecord._PartSn")]
        [Comment("产品条码")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string PartSn { get; set; }
        [Display(Name = "_Model._PackageRecord._StartTime")]
        [Comment("首次装箱时间")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public DateTime? StartTime { get; set; }
        [Display(Name = "_Model._PackageRecord._Package")]
        [Comment("包装箱")]
        public PackageBank Package { get; set; }
        [Display(Name = "_Model._PackageRecord._Package")]
        [Comment("包装箱")]
        public long? PackageId { get; set; }
        [Display(Name = "_Model._PackageRecord._Remark")]
        [Comment("备注")]
        public string Remark { get; set; }
        [Display(Name = "_Model._PackageRecord._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
